package dq.study.designmodel.filter;

/**
 * @author dongqun
 * @Description:
 * @date 2019/3/9 16:16
 */
public class MyFilter3 implements Filter {

    @Override
    public int filter(Request request, Response response, FilterChain chain) {
        //中断责任链的关键，就不再执行chain.doFilter，不会再将新的filter压入栈
        if (request.getRequest().contains("小星星")){
            return 1;
        }
        request.setRequest(request.getRequest().replace("小保健", "大") + "-->>myfilter3");
        chain.doFilter(request, response);
        response.setResponse(response.getResponse() + "---<<myfilter3");
        return 0;
    }
}
